//Khai bao thu vien
#include<conio.h>
#include<stdio.h>
int nguyento(int n)
{
	//Khai bao bien
	int i,kq;
	kq = 1; 			//Gia su n la so nguyen to
 	if(n<2)
 	{
	 	kq=0;			//Neu n<2 thi n khong la so nguyen to
 	}
 	for(i=2;i<=n/2;i++)
 	{
		if(n % i == 0)	//Neu k chia het cho i
	 	{
 	 		kq = 0;
		 	 break;		//Mat lap;
	  	}			
 	}
 	return kq;
}
void main()
{
	//Khai bao bien
	int n,kq;
	//xoa man hinh
	clrscr();
	printf("\n\tCHUONG TRINH KIEM TRA SO NGUYEN TO");
	//Nhap du lieu
	printf("\n\tNhap 1 so nguyen ndadadad:");
	scanf("%d",&n);
   	kq=nguyento(n);
	if (kq==1)
		printf("\n\t%d la so nguyen to",n);
	else
		printf("\n\t%d khong phai la so nguyen to",n);
	getch();
}
